package models

// CreateTask 发布任务结构体

type CreateTask struct {
	Id          int64   `gorm:"column:id;				type:int(20);primary_key"                   json:"id,string"`
	PublisherId int64   `gorm:"column:publisher_id;		type:bigint(20);	comment:发布人ID"         json:"publisher_id,string"`
	TaskName    string  `gorm:"column:task_name;			type:varchar(30);	comment:任务名称;"        json:"task_name" binding:"required"`
	PaymentFee  float64 `gorm:"column:payment_fee;				comment:支付费用;"        json:"payment_fee" binding:"required"`
	TaskContent string  `gorm:"column:task_content;		type:varchar(300);	comment:任务内容;"        json:"task_content" binding:"required"`
	TaskType    string  `gorm:"column:task_type;			type:varchar(20);	comment:任务类型;"        json:"task_type" binding:"required"`
	TaskStatus  string  `gorm:"column:task_status;		type:varchar(20);	comment:任务状态;"        json:"task_status" `
	OnlineTime  string  `gorm:"column:online_time;		type:varchar(100);		comment:任务上线时间"      json:"online_time"`
}

func (m *CreateTask) TableName() string {
	return "tasks"
}

type TaskWithUsername struct {
	Id                    int64   `gorm:"column:id;				type:int(20);primary_key"                   json:"id,string"`
	PublisherId           int64   `gorm:"column:publisher_id;		type:bigint(20);	comment:发布人ID"         json:"publisher_id,string"`
	TaskName              string  `gorm:"column:task_name;			type:varchar(30);	comment:任务名称;"        json:"task_name"`
	PaymentFee            float64 `gorm:"column:payment_fee;		type:int(11);		comment:支付费用;"        json:"payment_fee"`
	TaskContent           string  `gorm:"column:task_content;		type:varchar(300);	comment:任务内容;"        json:"task_content"`
	TaskType              string  `gorm:"column:task_type;			type:varchar(20);	comment:任务类型;"        json:"task_type"`
	TaskStatus            string  `gorm:"column:task_status;		type:varchar(20);	comment:任务状态0发布，1已接收，2已完成，3下架;"        json:"task_status"`
	PublishTime           string  `gorm:"column:publish_time;		type:varchar(100);		comment:发布时间"         json:"publish_time"`
	ReceiverId            int64   `gorm:"column:receiver_id;		type:bigint(20);	comment:接单人id"         json:"receiver_id,string"`
	ReceiverTime          string  `gorm:"column:receiver_time;		type:varchar(100);		comment:接单时间"         json:"receiver_time"`
	CompletionImage       string  `gorm:"column:completion_image;   type:varchar(20);   comment:任务完成图片"      json:"completion_image"`
	EndTime               string  `gorm:"column:end_time;			type:varchar(100);		comment:任务结束时间"      json:"end_time"`
	SystemConfirmTime     string  `gorm:"column:system_confirm_time;type:varchar(100);	comment:系统确认时间"      json:"system_confirm_time"`
	IsAfterSale           int     `gorm:"column:is_after_sale;		type:tinyint(1);	comment:是否售后"         json:"is_after_sale"`
	Notification          string  `gorm:"column:notification;		type:varchar(200);	comment:任务通知"         json:"notification"`
	OnlineTime            string  `gorm:"column:online_time;		type:varchar(100);		comment:任务上线时间"      json:"online_time"`
	CompletionTimeMinutes int     `gorm:"column:completion_time_minutes;type:int(11);	comment:任务多少分钟内完成" json:"completion_time_minutes"`
	ReviewTime            int     `gorm:"column:review_time		;type:int(11);		comment:发布者审核任务时间" json:"review_time"`
	UpdateTime            string  `gorm:"column:update_time;		type:varchar(100);		comment:任务更新时间"      json:"update_time"`
	PublishName           string  `gorm:"-"`
}

func (m *TaskWithUsername) TableName() string {
	return "tasks"
}
